﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GrayParrot.Web.Controls
{
    /// <summary>
    /// Controller Parameter class...
    /// </summary>
    /// <remarks>
    /// Specify the name of the control present on the form whose value is used as parameter for the grid loading function...
    /// </remarks>
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public class ControllerParameter
    {
        /// <summary>
        /// Gets or sets the name of the parameter...
        /// </summary>
        /// <value>
        /// The name of the parameter matches the name of the html control that holds the value for the parameter. 
        /// To be sure put the same name and the id for the html control...
        /// </value>
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets the default value...
        /// </summary>
        /// <value>
        /// The default value...
        /// </value>
        public string DefaultValue { get; set; }

        /// <summary>
        /// Gets or sets the alias.
        /// </summary>
        /// <value>
        /// The alias is useful when you have to pass formly form values as parameters to the Datatables.net grid...
        /// </value>
        public string Alias { get; set; }

        /// <summary>
        /// Gets or sets the evaluation code...
        /// </summary>
        /// <value>
        /// The evaluation code that is executed to get the HTML control value instead the standard jQuery .val() method...
        /// </value>
        public string Eval { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="ControllerParameter"/> class.
        /// </summary>
        public ControllerParameter()
        {
            DefaultValue = string.Empty;
            Alias = string.Empty;
            Eval = string.Empty;
        }
    }
}
